package com.guochenglang.www.service;

import com.guochenglang.www.pojo.Article;
import com.guochenglang.www.pojo.CollectArticle;
import com.guochenglang.www.pojo.CollectBase;
import com.guochenglang.www.pojo.CollectUser;
import com.guochenglang.www.service.anotate.Affair;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface CollectService {
    /**
     * 收藏知识库
     *
     * @param baseId 知识库id
     * @param userId 用户id
     * @return 收藏的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int collectBase(Integer baseId, Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 获得收藏的知识库列表
     *
     * @param userId 用户id
     * @return 知识库列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<CollectBase> collectBases(Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 取消收藏
     *
     * @param baseId 知识库id
     * @param userId 用户id
     * @return 取消的行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int deleteCollectBase(Integer baseId, Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 收藏文章
     *
     * @param articleId 文章id
     * @param userId    用户id
     * @return 收藏的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int collectArticle(Integer articleId, Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 收藏的文章列表
     *
     * @param userId 用户id
     * @return 文章列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<CollectArticle> collectArticles(Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 取消收藏文章
     *
     * @param articleId 文章id
     * @param userId    用户id
     * @return 取消的行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int deleteCollectArticle(Integer articleId, Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 取消收藏用户
     *
     * @param collectId 收藏的用户id
     * @param userId    用户id
     * @return 取消的行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int deleteCollectUser(Integer collectId, Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 获得关注的用户
     *
     * @param userId 用户id
     * @return 关注列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<CollectUser> collectUsers(Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 关注用户
     *
     * @param userId    用户id
     * @param collectId 关注的用户id
     * @return 关注的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int collectUser(Integer userId, Integer collectId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 收藏用户的文章
     *
     * @param userId 收藏的用户id
     * @return 收藏用户的文章列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Article> collectUserArticles(Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 共同关注
     *
     * @param userId 第一个用户id
     * @param id     第二个用户id
     * @return 共同关注列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<CollectUser> ourCollectUser(Integer userId, Integer id) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;
}
